<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS promise</title>
</head>
<body>
<p>等待超时，使用promise实例</p>
<h1 id="demo"></h1>
<script>
  const myPromise = new Promise(function(myResolve, myReject) {
    setTimeout(function(){ myResolve("I love You !!"); }, 3000);
  });

  myPromise.then(function(value) {
    document.getElementById("demo").innerHTML = value;
  });
</script>
</body>
</html>